/*
 * Copyright 2002-2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.chimi.s4s.config;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 다음의 두 가지 작업을 통해 설정 관련 정보를 초기화한다.
 * <ol>
 * <li>Log4jConfigurator를 이용 Lo44j 설정을 초기화한다.</li>
 * <li>SystemPropertiesSetter를 이용해서 필요한 시스템 프로퍼티를 설정한다.</li>
 * </ol>
 * 
 * @author Choi Beom Kyun
 * @see SystemPropertiesSetter
 * @see Log4jConfigurator
 */
public class SystemConfigLoaderContextListener implements
		ServletContextListener {

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		Log4jConfigurator.configure();

		SystemPropertiesSetter setter = new SystemPropertiesSetter();
		setter.loadAndSet();
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
	}

}
